<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../easyUI/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../easyUI/themes/icon.css">
		<script type="text/javascript" src="../easyUI/jquery.min.js"></script>
		<script type="text/javascript" src="../easyUI/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../addressIP.js"></script>
		<script type="text/javascript" src="../datagrid-filter.js"></script>
		<script type="text/javascript" src="../easyUI/datagrid-export.js"></script>
		<script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/datagrid/jeasyui.extensions.datagrid.getDom.js"></script>
		<script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/datagrid/jeasyui.extensions.datagrid.getColumnInfo.js"></script>
		<script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/datagrid/jeasyui.extensions.datagrid.getRowData.js"></script>
		<script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/datagrid/jeasyui.extensions.datagrid.tooltip.js"></script>
	</head>
	<body>
		<table id="dg"></table>
		<script type="application/javascript">
			$('#dg').datagrid({

				columns: [
					[
						{
							field: 'labKey',
							title: '实验室',
							width: '13.4%',
							align: 'center',
							formatter: function(value, row) {
								if (row.lab) {
									row.labKey = row.lab.labNum;
									return row.lab.labNum;
								} else {
									return value;
								}
							}
						},
						{
							field: 'user_name',
							title: '学生姓名',
							width: '13.4%',
							align: 'center',
							formatter: function(value, row) {
								if (row.user) {
									row.user_name = row.user.name;
									return row.user.name;
								} else {
									return value;
								}
							}
						},
						{
							field: 'className',
							title: '所在班级',
							width: '13.4%',
							align: 'center',
							formatter: function(value, row) {
								if (row.user) {
									row.className = row.user.className;
									return row.user.className;
								} else {
									return value;
								}
							}
						},
						{
							field: 'computerNum',
							title: '电脑编号',
							width: '13.4%',
							align: 'center',
							formatter: function(value, row) {
								if (row.computerNum) {
									if (row.computerNum == '-1') {
										row.computerNum = '未使用电脑';
										return "未使用电脑"
									} else {
										return value;
									}
								} else {
									return value;
								}
							}
						},
						{
							field: 'inTime',
							title: '进入时间',
							width: '16.4%',
							align: 'center'
						}, {
							field: 'outTime',
							title: '离开时间',
							width: '16.4%',
							align: 'center',
							formatter: function(value, row) {
								if (row.outTime) {
									return value;
								} else {
									return '用户尚未离开';
								}
							}
						}, {
							field: 'active',
							title: '活动记录',
							align: 'center',
							width: '13.4%',
							formatter: function(value, row) {
								if(!(row.outTime)){
									value = '等待用户签退...';
								}
								return "<span title='" + value + "'>" + value + "</span>";
							}
						}
					]
				]
			});
		</script>
		<script type="text/javascript">
			$(function() {
				var dg = $('#dg').datagrid({
					url: addressip + "/superGetRecord",
					queryParams: {
						account: localStorage.getItem("superAccount"),
						password: localStorage.getItem("password")
					},
					fitColumns: true,
					loadMsg: '数据加载中^_^',
					striped: true, //显示斑马线
					loadMsg: '等等我。。',
					idField: 'userID',
					pagination: true,
					fit: true,
					fitColumns: true,
					checkbox: true,
					autoRowHeight: false,
					emptyMsg: '暂无数据',
					pageSize: 15,
					pageList: [15, 25, 50, 99999995]
				});
				dg.datagrid('enableFilter', [{
						field: 'inTime',
						type: 'datetimebox',
						options: {
							precision: 1
						},
						op: ['less', 'greater']
					},
					{
						field: 'outTime',
						type: 'datetimebox',
						options: {
							precision: 1
						},
						op: ['less', 'greater']
					}
				]);
				var fbutton = dg.datagrid('getPager');
				fbutton.pagination({
					buttons: [{
						iconCls: 'icon-redo',
						handler: function() {
							$('#dlg').dialog('open');
							$('#dlg').window('center');
						}
					}]
				});
			});
		</script>
		<div id="dlg" class="easyui-dialog" title="导出使用记录" data-options="iconCls:'icon-save',closed:true" style="width:420px;height:320px;padding:10px">
			<form id="dow" action="">
				<div style="margin-bottom:20px">
					<input id="labNum" name="labNum" class="easyui-textbox" label="实验室门牌:" labelPosition="top" data-options="prompt:'实验室门牌'" style="width:100%;">
				</div>
				<br>
				<div style="margin-bottom:20px">
					<input id="startTime" name="startTime" label="开始时间:" class="easyui-datetimebox" name="birthday" data-options="required:true,showSeconds:false"
						   style="width:100%">
				</div>
				<br>
				<div style="margin-bottom:20px">
					<input id="limitTime" name="limitTime" label="截止时间:" class="easyui-datetimebox" name="birthday" data-options="required:true,showSeconds:false"
						   style="width:100%">
				</div>
				<div>
					<input  class="" type="submit" label="点击下载" formmethod="post"  style="margin-bottom:20px">
				</div>
			</form>
		</div>
	</body>
<script>
	$(function(){
		var ttt = addressip+"/downloadRecord";
		document.getElementById("dow").action=ttt;
	});
</script>
</html>
